
export const flattenArr=(arr)=>{
    return arr.reduce((obj,item)=>{
        obj[item.id]=item
        return obj
    },{})
}

export const objToArr=(obj)=>{
    return Object.keys(obj).map(key=>obj[key])
}

//获取父级元素
export const getParentNode=(node,parentClassName)=>{
    let current=node
    while(current!==null){
        if(current.classList.contains(parentClassName)){
            return current
        }
        current=current.parentNode
    }
    return false 
}